package com.colbby.datahouse.message;

import java.sql.Connection;

import com.colbby.datahouse.db.ConnectionContext;

public class ConnectionUtils {

	private static ConnectionContext context = new ConnectionContext("com.mysql.jdbc.Driver");
	
	static {
		String url = "jdbc:mysql://localhost:3306/data-house?useUnicode=true&characterEncoding=utf8";
		String user = "root";
		String password = "rechard";
		context.setUrl(url)
			   .setUser(user)
			   .setPassword(password);
	}
	
	public static boolean hasConnection() {
		return context.hasConnection();
	}
	
	public static Connection getConnection() {
		return context.get();
	}
	
	public static void release() {
		context.remove();
	}
}
